module ModeComparator (
    a, b, m, y
);

    input [7:0] a;
    input [7:0] b;
    input m;
    output[7:0] y;
    
    wire agb;

    comp #(.n(8)) uut (
        .a(a),
        .b(b),
        .agb(agb),
        .aeb(),
        .alb()
    );
    wire addr = (m&&agb)||((~m)&&(~agb));

    mux_2to1 #(.n(8))mux1(.out(y), .in0(a), .in1(b), .addr(addr));
endmodule 